# Natural Language Processing with Deep Learning CS224N/Ling284

Source: https://satotaiki.com/Natural%20Language%20Processing%20with%20Deep%20Learning%20CS224N~2FLing284

Content-Signal: ai-train=no, search=yes, ai-input=yes

#読んだ #LLM #機械学習


[[https://gyazo.com/660b49aabf9a5c33b6cd6f4bd770f4ca]]

http://web.stanford.edu/class/cs224n/slides/cs224n-2023-lecture11-prompting-rlhf.pdf


[[https://pbs.twimg.com/media/FpG5fHpaIAAMpva.jpg]]

> Since prompting, instruction tuning, RLHF, ChatGPT etc are such new and fast-moving topics, I haven't seen many university course lectures covering this content.
> So we made some new slides for this year's CS224n: NLP w/ Deep Learning course at @Stanford!
> [X@jayelmnop](https://twitter.com/jayelmnop/status/1626297445323010048?t=g1pX1k51FPrT1fsyd3RxAg&s=06)


## 言語モデルからアシスタントへ

- [[Zero-Shot]] (ZS) および [[Few-Shot]] (FS) の [[in-context learning]]
  - [[fine-tuning]] 不要で、[[CoT]] などの [[prompt engineering]] により精度向上ができる
    - 制限がある（たくさん例示は厳しい）
    - 複雑なタスクはまだ出来ない（従来の fine-tuning による勾配更新が必要）
- instruction finetuning
  - [[事前学習]]済みのLMに対し、多くのタスクに渡る命令と出力のペアを集め、 fine-tuning する
  - [[https://gyazo.com/84987fdc6a9c8db641d0b28a07792852]]
  - [[https://gyazo.com/354d501548e1cc5b2110f5704dcc01c5]]
  - シンプルで分かりやすく、未知のタスクへの汎化ができる
  - 多くのタスクの例を集めるのはコスト面で高価
  - LMと人間の目的が厳密に異なるとき、人間の趣向を明示的に満たせない
- Reinforcement Learning from Human Feedback ([[RLHF]])
  - 事前学習 + fine-tuning より高い効果
  - [[https://gyazo.com/f18905634d4aac6bbab19894702faf9c]]
  - [[InstructGPT]] : RLHF を 30k のタスクに拡張する
  - 人間の趣向は信頼できるか怪しい
    - Reward modeling の限界
      - [[https://gyazo.com/bef0858561b204846535a1dc530ae99b]]
    - Chatbot だと権威性があり役立ちそうなレスポンスを生成する方向に最適化される
      - それが真実かどうかは関係ない
      - → [[ハルシネーション]] へつながる
- What's Next?
  - RLHF はまだデータコストが掛かる
    - [Constitutional AI] の登場
      - [[https://gyazo.com/6cf305f3ef642b88727e99cf37e900a7]]



## GPT (2018)

- 117M パラメータ
- 12層の [[Transformer]] デコーダ
- 4.6GB のテキスト BooksCorpus

## GPT-2 (2019)

- 1.5B パラメータ
- 同じアーキテクチャ
- 40GB のテキスト WebText
- Zero-Shot learning
  - 例なしで多くのタスクを実行する能力
    - 正しいシーケンス予測（Q&A）や、配列の確率の比較など
  - GPT-2 はタスクに応じた微調整を行わない言語モデリングにおいて[[SoTA]]

## GPT-3 (2020)

- 175B パラメータ
- 600GB 以上のデータ
- Few-Shot learning
  - = in-context learning
  - タスクの例を前置してタスクを指定
  - [[https://gyazo.com/66071268d66771bcd6c125e5f08a8884]]
  - [[https://gyazo.com/ec32e142cfb3b178730fba9d0320402a]]
- これまでの fine-tuning は勾配の更新が伴うが、prompting による擬似的な fine-tuning が勾配の更新なしでできるようになった
  - [[https://gyazo.com/e02e482922fa2929ecca84390f453ac5]]
  - ただし、タスクによっては難しい
    - [[https://gyazo.com/d6bac728d1d89935a49d1d90f96ba2f8]]
- [[Chain-of-Thought]] prompting
  - [[https://gyazo.com/ce88b0955e131936ba1e97bc94557083]]
- Zero-Shot の CoT prompting
  - [[Let's think step by step.]]
  - [[https://gyazo.com/cb78758540a551a5cd136beaa071d259]]
  - [[https://gyazo.com/4b6dd71a73deb04588ffac44ccb11c93]]
  - [[https://gyazo.com/1c9b99788721664c4067d53e4be35ac7]]
